package com.leyou.upload.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.leyou.upload.properties.OSSProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/4/29 0029
 * Time: 23:03
 */

@Configuration
public class OSSConfig {
    @Bean
    public OSS ossClient(OSSProperties prop) {
        return new OSSClientBuilder()
                .build(prop.getEndpoint(),
                        prop.getAccessKeyId(),
                        prop.getAccessKeySecret());
    }
}
